using System;
using System.Collections.Generic;
using DevExpress.XtraBars;
using PharmacyPharnet.Core.CustomEventArgs;
using Pharmacy.Data;



namespace PharmacyPharnet.Core.ContextMenu
{
    public class ItemPopUp : CustomBasePopUp
    {
        private IObjectContext pharmacyContext;
        private CustomBaseEventArg eventArg;
        public ItemPopUp(BarManager barManager)
        {
            this.Manager = barManager;
            LoadItemToPopUp();
        }


        public ItemPopUp(IObjectContext objectContext, BarManager barManager)
        {
            pharmacyContext = objectContext;
            Manager = barManager;
            //LoadItemToPopUp();
        }

        private void LoadItemToPopUp()
        {
            //CustomButtonBarItem similarItem = this.AddMenuItem("similarItem", "Find Substitute Item");
            //similarItem.Execute += new ExecuteHandler(similarItem_Execute);
            //similarItem.WhoAmI = PopUpItems.GETSIMILARITEM;

            //CustomButtonBarItem itemDetail = this.AddMenuItem("itemDetail", "Show Item 's Detail");
            //itemDetail.WhoAmI = PopUpItems.SHOWITEMDETAIL;

            //CustomButtonBarItem itemSerial = this.AddMenuItem("itemSerial", "Serials of Item");
            //itemSerial.Execute += new ExecuteHandler(itemSerial_Execute);
            //itemSerial.WhoAmI = PopUpItems.SERIALOFITEM;

            //CustomButtonBarItem itemBatch = this.AddMenuItem("itemBatch", "Batchs of Item");
            //itemBatch.Execute += new ExecuteHandler(itemBatch_Execute);
            //itemBatch.WhoAmI = PopUpItems.BATCHOFITEM;

            //CustomButtonBarItem itemSupplyDeman = this.AddMenuItem("itemSupplyDemand", "Supply Demand");
            //itemSupplyDeman.Execute += new ExecuteHandler(itemSupplyDeman_Execute);
            //itemSupplyDeman.WhoAmI = PopUpItems.SUPPLYDEMAND;

            //CustomButtonBarItem itemCasePackRepackInventory = this.AddMenuItem("itemCasepackRepackInventory", "Casepack/ Prepack Inventory");
            //itemCasePackRepackInventory.Execute += new ExecuteHandler(itemCasePackRepackInventory_Execute);
            //itemCasePackRepackInventory.WhoAmI = PopUpItems.CASEPACKREPACKINVENTORY;

            ////CustomButtonBarItem itemCrossTabInventoryReport = this.AddMenuItem("itemCrossTabInventoryReport", "CrossTab Report Inventory");
            ////itemCrossTabInventoryReport.Execute += new ExecuteHandler(itemCrossTabInventoryReport_Execute);
            ////itemCrossTabInventoryReport.WhoAmI = PopUpItems.CROSSTABINVENTORYREPOR;
            ////itemCrossTabInventoryReport.Visibility = BarItemVisibility.Never;

            //CustomButtonBarItem itemPrice = this.AddMenuItem("itemPrice", "Item Price");
            //itemPrice.Execute += new ExecuteHandler(itemPrice_Execute);
            //itemPrice.WhoAmI = PopUpItems.ITEMPRICE;

            //CustomButtonBarItem itemPrintBarcode = this.AddMenuItem("printBarcode", "Print Barcode");
            //itemPrintBarcode.Execute += new ExecuteHandler(itemPrintBarcode_Execute);
            //itemPrintBarcode.WhoAmI = PopUpItems.PRINTBARCODE;

            //CustomButtonBarItem searchItem = this.AddMenuItem("searchItem", "View Case-Pack/Pre-Pack");
            //searchItem.Execute += new DIoms.Core.ExecuteHandler(searchItem_Execute);
            //searchItem.WhoAmI = PopUpItems.SEARCHITEM;


        }

        //void itemPrintBarcode_Execute(object sender, CustomBaseEventArg e)
        //{
        //    if (e.Params.ContainsKey("ERPItemCode"))
        //    {
               
        //    }
        //}
        //void searchItem_Execute(object sender, CustomBaseEventArg e)
        //{
           
        //}
        //void itemPrice_Execute(object sender, CustomBaseEventArg e)
        //{
            
        //}

        //void itemCrossTabInventoryReport_Execute(object sender, CustomBaseEventArg e)
        //{
            
        //}

        //void itemCasePackRepackInventory_Execute(object sender, CustomBaseEventArg e)
        //{
            
        //}

        //void itemSupplyDeman_Execute(object sender, CustomBaseEventArg e)
        //{
            
        //}

        //void itemBatch_Execute(object sender, CustomBaseEventArg e)
        //{
        //    //if (e.Params.ContainsKey("ItemID"))
        //    //{
        //    //    int itemID = (int)e.Params["ItemID"];
        //    //    FrmViewBatchSerial frm = new FrmViewBatchSerial(itemID, null, "DIO_Batch");
        //    //    frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
        //    //    frm.ShowDialog();

        //    //}
        //}


        //void similarItem_Execute(object sender, DIoms.Core.CustomBaseEventArg e)
        //{
        //    //if (_sessionKey == null)
        //    //    _sessionKey = new PessimisticSessionKey();

        //    //this.eventArg = e;
        //    //CustomButtonBarItem item = (CustomButtonBarItem)sender;
            
        //    //if (e.Params["ListItemBase"] != null)
        //    //{
        //    //    if (item.WhoAmI == PopUpItems.GETSIMILARITEM)
        //    //    {
        //    //        FrmSearchItem<DIO_ItemBase> dialog = new FrmSearchItem<DIO_ItemBase>(_sessionKey, "Substitute Item", true, (ArrayList)e.Params["ListItemBase"]);
        //    //        dialog.OnSelectedItem += new FrmSearchItem<DIO_ItemBase>.SelectedItemHandler(dialog_OnSelectedItem);
        //    //        ViewManager.ShowView(dialog);
        //    //    }
        //    //}
        //}

        //void dialog_OnSelectedItem(DIO_ItemBase selectedItem)
        //{
        //    this.eventArg.ResultObject = selectedItem;
        //}

        //void itemSerial_Execute(object sender, CustomBaseEventArg e)
        //{
        //    if (e.Params.ContainsKey("ItemID"))
        //    {
        //        int itemID = (int)e.Params["ItemID"];
        //        FrmViewBatchSerial frm = new FrmViewBatchSerial(itemID, null,"DIO_Serial");
        //        frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
        //        frm.ShowDialog();
                
        //    }
        //}

    }
}
